= api_form_for @bm_create_button, :url => button_manager_path(:bm_create_button) do |f|

  .row
    .span5
      %legend Create button request
      = f.input :ButtonType
      = f.input :ButtonCode
      %legend For payment plan button
      = f.fields_for :OptionDetails do |opt|
        = opt.fields_for :OptionSelectionDetails do |det|
          = det.fields_for :PaymentPeriod do |per|
            = per.input :Amount
            = per.input :BillingFrequency
            = per.input :TotalBillingCycles
            = per.input :BillingPeriod
          = det.input :OptionType
    .span5
      %legend Button var
      .control-group
        %label.control-label{:for => "ButtonVar_item_name"} Item
        .controls= text_field_tag "ButtonVar[item_name]", @button_var["item_name"]
      .control-group
        %label.control-label{:for => "ButtonVar_amount"} Amount
        .controls= text_field_tag "ButtonVar[amount]", @button_var["amount"]
      .control-group
        %label.control-label{:for => "ButtonVar_return"} Return Url
        .controls= text_field_tag "ButtonVar[return]", @button_var["return"]
      .control-group
        %label.control-label{:for => "ButtonVar_notify_url"} Notify Url
        .controls= text_field_tag "ButtonVar[notify_url]", @button_var["notify_url"]
      .control-group
        %label.control-label{:for => "ButtonVar_shopping_url"} Shipping Url
        .controls= text_field_tag "ButtonVar[shopping_url]", @button_var["shopping_url"]
      .control-group
        %label.control-label{:for => "ButtonVar_min_amount"} Min Amount
        .controls= text_field_tag "ButtonVar[min_amount]", @button_var["min_amount"]
      .control-group
        %label.control-label{:for => "ButtonVar_subtotal"} Sub Total
        .controls= text_field_tag "ButtonVar[subtotal]", @button_var["subtotal"]

      %legend For Subscribe
      .control-group
        %label.control-label{:for => "ButtonVar_t3"} Billing cycle units
        .controls= select_tag "ButtonVar[t3]", options_for_select(["", "D", "W", "M", "Y"]), :value => @button_var["t3"]
      .control-group
        %label.control-label{:for => "ButtonVar_p3"} Billing cycle
        .controls= text_field_tag "ButtonVar[p3]", @button_var["p3"], :placeholder => "Ex: 1"
      .control-group
        %label.control-label{:for => "ButtonVar_a3"} Price
        .controls= text_field_tag "ButtonVar[a3]", @button_var["a3"], :placeholder => "Ex: 10.00"

  .form-actions
    = f.submit "Submit", :class => "btn btn-primary", :data => { :disable_with => "Processing.." }

- if @bm_create_button_response
  = render 'api_response', :request => @bm_create_button, :response => @bm_create_button_response
  = link_to "Email link", @bm_create_button_response.Email if @bm_create_button_response.Email
